{extends file='layout/admin.html'}

{block name='title'}Manage Administrative Users  - Geek-Zoo CMS{/block}

{block name='content'}

<h1>Edit User</h1>
<h2 class="pb10">Edit additional user accounts</h2>
<div class="clearfix sub_nav b_border">
	<span class="btn fr"><a href="admin/registered_users.html">Cancel</a></span><span class="btn fr"><a href="#" class="save">Save</a></span>
</div>
<form action="admin/registered_users/edit/{$info.id}" method="post" accept-charset="utf-8">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="content_table">
	<thead>
		<tr style="height: 20px">
			<th class="left"></th>
			<th class="right"></th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td style="width: 30%" class="left_label large tar">Username</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[user_name]" value="{$info.user_name}" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">First Name</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[first_name]" value="{$info.first_name}" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">Last Name</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[last_name]" value="{$info.last_name}" /></td>
		</tr>
		<tr>
			<td style="width: 30%" class="left_label large tar">Password</td>
			<td class="right_label"><input type="password" class="input_text w290" name="info[password]" /></td>
		</tr>
		<tr>
			<td style="width: 30%; height 60px;" class="left_label large tar">Confirm Password</td>
			<td class="right_label"><input type="password" class="input_text w290" name="re_password" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">Email</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[email]" value="{$info.email}" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">Company Name</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[company]" value="{$info.company}" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">Phone Number</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[phone]" value="{$info.phone}" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">Address</td>
			<td class="right_label"><input type="text" class="input_text w290" name="info[address]" value="{$info.address}" /></td>
		</tr>
		<tr>
			<td style="width: 30%;" class="left_label large tar">User Status</td>
			<td class="right_label">
				<select name="info[status]">
					<option value="0" {if $info.status == 0}selected{/if}>Open</option>
					<option value="1" {if $info.status == 1}selected{/if}>Close</option>
				</select>
			</td>
		</tr>
		
		<tr>
			<td style="width: 30%;" class="left_label large tar">User Group</td>
			<td class="right_label">
				<select name="info[user_group]">
				<option value="0">Ordinary users</option>
				{foreach $admin_group as $val}
				<option value="{$val.id}"{if $info.user_group == $val.id} selected{/if}>{$val.group_name}</option>
				{/foreach}
		    </select>
			</td>
		</tr>
		

		</tbody>
</table>
</form>
<div class="clearfix sub_nav t_border">
	<span class="btn fr"><a href="admin/registered_users.html">Cancel</a></span><span class="btn fr"><a href="#" class="save">Save</a></span>
</div>
<script type="text/javascript" charset="utf-8">
var user_name = $('input[name=info[user_name]]');
var password = $('input[name=info[password]]');
var re_password = $('input[name=re_password]');
var email = $('input[name=info[email]]');
dialog_title = 'Edit additional user accounts';

$('a.save').click(function(){
  if (!user_name.val()) {
    show_msg('User Name Not Allow Empty!', function(){
      user_name.focus();
    });

    return false;
  }

  if (password.val() && re_password.val() != password.val()) {
    show_msg('User Password And Confirm Password Do Not Match!', function(){
      re_password.focus();
    });

    return false;
  }

  if (!email.val()) {
    show_msg('User Email Not Allow Empty!', function(){
      email.focus();
    });

    return false;
  }

  $('form').submit();
  return false;
});
</script>
{/block}